/*
 * Copyright (c) 2015, FPX and/or its affiliates. All rights reserved.
 * Use, Copy is subject to authorized license.
 */
package com.fpx.xms.api.base.model;

import java.util.Date;

import org.apache.commons.lang3.StringUtils;

import com.fpx.open.platform.common.constant.SysConstant;

/**
 * 调用日志模型
 * @author shiwei
 * @date 2015年6月24日
 */
public class InvokeLog {
	
	/** 日志id */
	private Integer id;
	
	/** 服务商单号 */
	private String serverOrderNo;
	
	/** 客户单号 */
	private String customerOrderNo;
	
	/** 接口名称 */
	private String interfaceName;
	
	/** 请求报文 */
	private String requestContent;
	
	/** 响应报文 */
	private String responseContent;
	
	/** 请求时间 */
	private Date requestTime;
	
	/** 响应时间 */
	private Date responseTime;
	
	/** 调用时使用的token */
	private String token;
	
	/** 是否调用成功，Y：成功，N：失败 */
	private String isSuccess;
	
	/** 异常信息 */
	private String exception;
	
	/** 消息异步实际处理结果,若失败,则记录异常信息*/
	private String actualResult  ;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getInterfaceName() {
		return interfaceName;
	}

	public void setInterfaceName(String interfaceName) {
		this.interfaceName = interfaceName;
	}

	public String getRequestContent() {
		return requestContent;
	}

	public void setRequestContent(String requestContent) {
		this.requestContent = requestContent;
	}

	public String getResponseContent() {
		return responseContent;
	}

	public void setResponseContent(String responseContent) {
		this.responseContent = responseContent;
	}

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	public String getIsSuccess() {
		return isSuccess;
	}

	public void setIsSuccess(String isSuccess) {
		this.isSuccess = isSuccess;
	}

	public Date getRequestTime() {
		return requestTime;
	}

	public void setRequestTime(Date requestTime) {
		this.requestTime = requestTime;
	}

	public Date getResponseTime() {
		return responseTime;
	}

	public void setResponseTime(Date responseTime) {
		this.responseTime = responseTime;
	}

	public String getException() {
		return exception;
	}

	public void setException(String exception) {
		this.exception = exception;
	}

	public String getServerOrderNo() {
		return serverOrderNo;
	}

	public void setServerOrderNo(String serverOrderNo) {
		this.serverOrderNo = serverOrderNo;
	}

	public String getCustomerOrderNo() {
		return customerOrderNo;
	}

	public void setCustomerOrderNo(String customerOrderNo) {
		this.customerOrderNo = customerOrderNo;
	}
	
	public String getLogType() {
		return LogTypeEnum.valueOf(this.interfaceName).getLabel();
	}
	
	public String getInvokeResult(){
		if(StringUtils.equals(this.isSuccess, SysConstant.YES)){
			return "成功";
		}
		return "失败";
	}

	public String getActualResult() {
		return actualResult;
	}

	public void setActualResult(String actualResult) {
		this.actualResult = actualResult;
	}
	
}
